{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "82674076879277258572496581009301773302984486449338756300825298450\n"
     ]
    }
   ],
   "source": [
    "# 从n到m的连乘函数\n",
    "# 计算lc(1, 50) + ... +lc(49, 50)\n",
    "def lc(n, m):\n",
    "    r = 1\n",
    "    i = n\n",
    "    while i <= m:\n",
    "        r *= i\n",
    "        i += 1\n",
    "    return r\n",
    "r = 0\n",
    "i = 1\n",
    "while i <= 49:\n",
    "    r += lc(i, 50)\n",
    "    i += 1\n",
    "print(r)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入一个数字N，我可以回答你几个问题 6\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "你可以问如下问题:\n",
      "    1 类型\n",
      "    2 是不是质数\n",
      "    3 1累加到N的和\n",
      "    4 1累乘到N的积\n",
      "    5 是奇数还是偶数\n",
      "    6 帮助信息\n",
      "\n"
     ]
    },
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "你的选择 5\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "偶数\n"
     ]
    }
   ],
   "source": [
    "n = int(input('请输入一个数字N，我可以回答你几个问题'))\n",
    "print('''\n",
    "你可以问如下问题:\n",
    "    1 类型\n",
    "    2 是不是质数\n",
    "    3 1累加到N的和\n",
    "    4 1累乘到N的积\n",
    "    5 是奇数还是偶数\n",
    "    6 帮助信息\n",
    "''')\n",
    "def type_of(n):\n",
    "    return type(n)\n",
    "def lj(n, m):\n",
    "    r = 0\n",
    "    i = n\n",
    "    while i <= m:\n",
    "        r += i\n",
    "        i += 1\n",
    "    return r\n",
    "def odd_even(n):\n",
    "    if n % 2 == 0:\n",
    "        return '偶数'\n",
    "    else:\n",
    "        return '奇数'\n",
    "def is_prime(n):\n",
    "    status = '质数'\n",
    "    if n >= 2:\n",
    "        i = n - 1\n",
    "        while i >= 2:\n",
    "            if n % i == 0:\n",
    "                status = '合数'\n",
    "            i -= 1\n",
    "    else:\n",
    "        status = '不在讨论范围之内'\n",
    "    return status\n",
    "\n",
    "c = int(input('你的选择'))\n",
    "if c == 1:\n",
    "    print(type_of(n))\n",
    "elif c == 2:\n",
    "    print(is_prime(n))\n",
    "elif c == 3:\n",
    "    print(lj(1, n))\n",
    "elif c == 4:\n",
    "    print(lc(1, n))\n",
    "elif c == 5:\n",
    "    print(odd_even(n))\n",
    "elif c == 6:\n",
    "    print(my_help())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
